/*
 * BooleanFunction.h
 *
 *  Created on: 28/dic/2010
 *      Author: computer
 */

#ifndef BOOLEANFUNCTION_H_
#define BOOLEANFUNCTION_H_
#include "Function.h"
#include "Integer.h"
#include "Real.h"
#include "Rational.h"
#include "Bool.h"

class IIGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getData() > b->getData());
	}
};

class FIGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getData() > b->getData());
	}
};

class IFGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getData() > b->getData());
	}
};

class FFGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getData() > b->getData());
	}
};

class RRGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(a->getNumerator()*b->getDenominator() > b->getNumerator()*a->getDenominator());
	}
};

class RFGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getNumerator()/(double)a->getDenominator()>b->getData());
	}
};

class RIGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getNumerator()>b->getData()*a->getDenominator());
	}
};

class IRGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(b->getNumerator()>a->getData()*b->getDenominator());
	}
};

class FRGreaterSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(a->getData()>b->getNumerator()/(double)b->getDenominator());
	}
};

class IILessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getData() < b->getData());
	}
};

class FILessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getData() < b->getData());
	}
};

class IFLessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getData() < b->getData());
	}
};

class FFLessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getData() < b->getData());
	}
};

class RRLessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(a->getNumerator()*b->getDenominator() < b->getNumerator()*a->getDenominator());
	}
};

class RFLessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getNumerator()/(double)a->getDenominator()<b->getData());
	}
};

class RILessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getNumerator()<b->getData()*a->getDenominator());
	}
};

class IRLessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(b->getNumerator()<a->getData()*b->getDenominator());
	}
};

class FRLessSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(a->getData()<b->getNumerator()/(double)b->getDenominator());
	}
};

class IILogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getData() == b->getData());
	}
};

class FILogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getData() == b->getData());
	}
};

class IFLogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getData() == b->getData());
	}
};

class FFLogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getData() == b->getData());
	}
};

class RRLogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(a->getNumerator()*b->getDenominator() == b->getNumerator()*a->getDenominator());
	}
};

class RFLogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getNumerator()/(double)a->getDenominator()==b->getData());
	}
};

class RILogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getNumerator()==b->getData()*a->getDenominator());
	}
};

class IRLogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(b->getNumerator()==a->getData()*b->getDenominator());
	}
};

class FRLogicalEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(a->getData()==b->getNumerator()/(double)b->getDenominator());
	}
};

class IILogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getData() != b->getData());
	}
};

class FILogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getData() != b->getData());
	}
};

class IFLogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getData() != b->getData());
	}
};

class FFLogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getData() != b->getData());
	}
};

class RRLogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(a->getNumerator()*b->getDenominator() != b->getNumerator()*a->getDenominator());
	}
};

class RFLogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Real* b) const {
		return new TreeExpression::Bool(a->getNumerator()/(double)a->getDenominator()!=b->getData());
	}
};

class RILogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Rational* a, TreeExpression::Integer* b) const {
		return new TreeExpression::Bool(a->getNumerator()!=b->getData()*a->getDenominator());
	}
};

class IRLogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Integer* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(b->getNumerator()!=a->getData()*b->getDenominator());
	}
};

class FRLogicalNEqualSimplify {
public:
	TreeExpression::Bool* operator()(TreeExpression::Real* a, TreeExpression::Rational* b) const {
		return new TreeExpression::Bool(a->getData()!=b->getNumerator()/(double)b->getDenominator());
	}
};

#endif /* BOOLEANFUNCTION_H_ */
